﻿<cfsilent>
	<cfscript>
	
		sql = "	SELECT
					c.campus_id,
					c.campus_name,
					c.campus_address,
					c.campus_zipcode
				FROM
					t_campus c
				WHERE
					c.campus_id = :campusId ";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam(name = "campusId", value = event.getArg("CID"), cfsqltype = "cf_sql_char");
		rs_campusEntity = queryObj.execute( sql = sql ).getResult();

	
		event.setArg("pageTitle", "教学运行基础数据 - 教学场地维护 - 校区概况 - " & rs_campusEntity.campus_name);

		targetArgs = structNew();
		structInsert(targetArgs, "CID", rs_campusEntity.campus_id, true);

		currentTab = event.getArg("TabID", "labBuilding");
		showNotice = event.getArg("notice");

		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('classroomResource')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">教学场地维护</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>校区概况 - <cfoutput>#rs_campusEntity.campus_name#</cfoutput>
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labBaseInfo">class="active"</cfif> id="labBaseInfo" tabTarget="BaseInfo">校区基础信息</span>
						<span <cfif currentTab eq "labBuilding">class="active"</cfif> id="labBuilding" tabTarget="Building">教学楼设置</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>				
				</script>
				
				<div id="BaseInfo" class="tabContent">
					
					<cfif currentTab eq "labBaseInfo">
						<div class="systemNotice">
							<h3><span class="img icon16x16 info"></span>校区基础数据已更新</h3>
							<p>在填写完整校区基础数据后, 你可以通过上面的标签切换, 分别查阅到该园区下设的教学楼宇信息.</p>
						</div>
					</cfif>
					
					<form id="formEdit" onSubmit="javascript:return processVerfiyForm('formEdit');" class="formWrapper" method="post" action="<cfoutput>#buildURL('campusUpdateDo')#</cfoutput>">
						
						<input type="hidden" name="CampusID" value="<cfoutput>#rs_campusEntity.campus_id#</cfoutput>" />
						
						<div class="label">
							<span class="req">*</span><b>校区名称</b>
							<input name="CampusName" id="CampusName" type="text" class="typeTextShort" verification="required" maxlength="15" value="<cfoutput>#event.getArg('CampusName', rs_campusEntity.campus_name)#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>街道地址</b>
							<input name="Address" id="Address" type="text" class="typeText" maxlength="30" value="<cfoutput>#event.getArg('Address', rs_campusEntity.campus_address)#</cfoutput>" />
						</div>
						<div class="label">
							<b>邮编</b>
							<input name="ZipCode" id="ZipCode" type="text" class="typeCode" maxlength="6" value="<cfoutput>#event.getArg('ZipCode', rs_campusEntity.campus_zipcode)#</cfoutput>" />
						</div>
						
						<div class="lable">
							<input class="button" type="submit" value="提交" />
							<input class="button" type="reset" value="重设表格" />
						</div>
						
					</form>
					
					<div class="systemNotice">
						<h3><span class="img icon16x16 info"></span>删除校区信息</h3>
						<p>注意: 删除一个校区信息的同时, 会同时删除该校区内的所有建筑物信息及相关行政班设置信息. </p>
						<p>如果您确定<cfoutput>#rs_campusEntity.campus_name#</cfoutput>在当前的教学安排中未使用, 并且在以后都不再使用这个校区, 您可以在这里进行信息删除. 如果这些教学场地还安排有相关教学任务, 由于数据完整性维护的强制性要求, 这些相关信息会被同样删除. </p>
					
						<form id="formRemove" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('campusRemoveDo')#</cfoutput>">
							<input type="hidden" name="CampusID" value="<cfoutput>#rs_campusEntity.campus_id#</cfoutput>" />
							<div class="lable"><input class="button2" type="submit" value="删除校区" /></div>
						</form>
					</div>

				</div>
				
				<div id="Building" class="tabContent">
					
					<cfif listFind(showNotice, "buildRemoved")>
						<div class="systemNotice">
							<h3><span class="img icon16x16 info"></span>楼宇数据已更新</h3>
							<p>您已成功删除建筑物数据信息, 所有与之相关的数据也同时进行了清理.</p>
						</div>
					</cfif>

                    <cfset sql = "	SELECT
										b.b_id,
										b.b_name,
										b.b_floors
									FROM
										t_building b
									WHERE
										b.campus_id = :campusId 
									ORDER BY
										b.b_id ASC"/>
								
					<cfset queryObj = new Query(datasource = application.dnsSlave) />
                    <cfset queryObj.addParam(name = "campusId", value = rs_campusEntity.campus_id, cfsqltype = "cf_sql_char")/>
                    <cfset rs_build = queryObj.execute(sql = sql).getResult() />
					
					<cfif rs_build.recordCount>
							
							<div class="noticeBlock">
								<div class="operation">
									<a class="uiButton uiButtonSpecial" href="<cfoutput>#buildURL('classroomCampusDownloadExcel', targetArgs)#</cfoutput>"><i class="mrs img btnDownload"></i><span class="uiButtonText">下载校区教室数据</span></a>
								</div>
								<h3>楼宇信息</h3>
								<p><span class="img icon16x16 message"></span>这里列出的是<cfoutput>#rs_campusEntity.campus_name#</cfoutput>下设的楼宇信息. 如果您需要设置新的楼宇信息, <a href="javascript:showCreateFrom();">可以通过点击这里进行</a></p>
								<hr/>
							</div>
							
							<script language="javascript" type="text/javascript">
								//<![CDATA[
								<!--
								function showCreateFrom() {
									$("form#formCreate").toggleClass("hidden_elem");
									return void(0);
								}
								// -->
								//]]>				
							</script>
							
							<div class="clearfix">
								<div class="UICardTable">
                                    <cfloop query="rs_build">
										<cfset structInsert(targetArgs, "BID", rs_build.b_id, true) />
											
										<dl>
											<dt>
												<a href="<cfoutput>#buildURL('buildingSetting', targetArgs)#</cfoutput>">
													<em class="building"><!--imgholder--></em>
													<dd>
														<h3><cfoutput>#rs_build.b_name#</cfoutput></h3>
														<div><cfoutput>#dictAdvice.getBuildingFloorSummary(rs_build.b_floors)#</cfoutput></div>
													</dd>
												</a>
											</dt>
										</dl>
											
									</cfloop>
								</div>
							</div>
							
						<cfelse>
							<div class="systemNotice">
								<h3><span class="img icon16x16 info"></span>没有设置任何楼宇信息</h3>
								<p>当前您还没有设置<cfoutput>#rs_campusEntity.campus_name#</cfoutput>下属的教学楼宇信息, 请通过完善下列表单设置该教学园区的第一个教学楼.</p>
							</div>
					</cfif>
					
					<form id="formCreate" onSubmit="javascript:return processVerfiyForm('formCreate');" class="formWrapper <cfif rs_build.recordCount>hidden_elem</cfif>" method="post" action="<cfoutput>#buildURL('buildingCreateDo')#</cfoutput>">

						<input type="hidden" name="CampusID" value="<cfoutput>#rs_campusEntity.campus_id#</cfoutput>" />
						
						<div class="label">
							<span class="req">*</span><b>教学楼</b>
							<input name="BuildingName" id="BuildingName" type="text" class="typeTextShort" verification="required" maxlength="30" value="<cfoutput>#event.getArg('BuildingName')#</cfoutput>" />
						</div>
						
						<div class="label">
							<span class="req">*</span><b>楼层分布</b>
							地上<input name="FloorsUp" id="FloorsUp" type="text" class="typeTinyInt" verification="required" maxlength="2" value="" />层,
							地下<input name="FloorsDown" id="FloorsDown" type="text" class="typeTinyInt" verification="required" maxlength="2" value="0" />层
						</div>
						
						<hr/>
						
						<div class="lable">
							<input class="button" type="submit" value="提交" />
							<input class="button" type="reset" value="重设表格" />
						</div>
						
					</form>
					
				</div>
				
			</div>
		</li>
	</ul>
</div>
